
<?php
/*
 * Created on Sep 17, 2007
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */

//This part of the code gets the prevous insert (if any) and makes it so that option is automatically selected
$itemAdded = $_POST['itemAdded'];
unset($_POST['itemAdded']);
$table2 = $_POST['table'];
require('./Controller/UpdateBackEnd.php');
//echo "before " . print_r($line) . "</br>";
if($itemAdded) { //I totally forget what this is for, I think to make it so that update works properly.
	$addedID = mysql_insert_id();
	if($table == "CellType") {
		$table = 'CellTypeID';
	}
	if ($table == "Modification") {
		$table = "ModifiedByID";
	}
	if ($table == "Researcher") {
		$table = "FrozenByID";
	}
	//echo "id is " . $id . " table is " . $table. "</br>";
	$line[$table] = $addedID;
	//echo "after " . print_r($line);
}
require('./View/ModifyTubeBackEndInfo.php');
?>
<!--These two varables must be assigned in the parent script -->

<table>
	<tr>
		<td>
			<?php if(isset($_COOKIE['Helper'])): ?>
				<input style="height: 25px; width: 100px" type="submit" name="change" value="Update">
			<?php endif; ?>
		</td>
		
	</tr>
	<tr>
		<td>
			<a href="help.htm" target="_blank">Instructions for modifying a tube</a>
		</td>
	</tr>
</table>
<table border="0" cellpadding="5" align="left" valign="top">
	
		<tr>
		<td width="10%" align="left">
		Cell Type:
		</td>
		<td width="10%" align="left">
		Modification: 
		</td>
		<td width="10%" align="left">
		Researcher:
		</td>
	</td>
	<tr>
		<td width="10%" align="left">
			<SELECT name="CellTypeID">
			<? echo createDropDownBox("SELECT Name, id FROM CellType ORDER BY Name ASC", $line['CellTypeID'], 'id') ?>
			</SELECT>
			
		</td>
		
		<td width="10%" align="left">
				<SELECT name="ModifiedByID">
			<? echo createDropDownBox("SELECT Name, id FROM Modification ORDER BY Name ASC", $line['ModifiedByID'], 'id'); ?>
			</SELECT>	
	
		</td>
		
		<td width="10%" align="left">
					<SELECT name="FrozenByID">
			<? echo createDropDownBox("SELECT Name, id FROM Researcher ORDER BY Name ASC", $line['FrozenByID'], 'id'); ?>
			</SELECT>

		</td>
	</tr>
	<tr>
		<td width="10%" align="left">  
			<?php if(isset($_COOKIE['Helper'])): ?>
			<input type="Submit" name="addCellType" onClick="document.pressed='ignore'" value="Add New CellType">
			<?php endif; ?>
			
		</td>
		<td width="10%" align="left">
			<?php if(isset($_COOKIE['Helper'])): ?>
			<input type="Submit" name="addMod" onClick="document.pressed='ignore'" value="Add A New Modification">
			<?php endif; ?>
	
		</td>
		
		
		
		<td width="10%" align="left">
				<?php if(isset($_COOKIE['Helper'])): ?>
				<input type="Submit" name="addResearcher" onClick="document.pressed='ignore'" value="Add New Researcher">
				<?php endif; ?>
		</td>
	</tr>
	<tr>
		<td width="10%" align="left">
			Frozen On: </br>
			(MM/DD/YYYY) </br> 
			<input type="text" name="FrozenDate" value="<? echo ($_SERVER['PHP_SELF'] == '/LN2_Website/ModifyTube.php')? mysql2Date($line['FrozenDate']) : ""; ?>">
		</td>
		
		<td width="10%" align="left">
			Passage Frozen: </br> <input type="text" name="PassageFrozen" value="<? echo $line['PassageFrozen']; ?>">
		</td>

		<td width="10%" align="left">
			Number of Cells Frozen: </br> <input type="text" name="NumberFrozen" value="<? echo $line['NumberFrozen']; ?>">
		</td>
	</tr>
	<tr>
		<td width="10%" align="left">				
Notes: <textarea name="Note" rows="5" cols="40"><? echo $line['Note']; ?>
</textarea>
		</td>	
	</tr>
	<tr>
		<td width="10%" align="left">
		</td>
	</tr>
		<tr>
		<td>
			<?php //if(isset($_COOKIE['Helper'])): //Verionia Wanted this out, I tend to agree?>
				<input type="submit" name="clear" onClick="document.pressed='question'" value="Clear the Tube">
			<?php //endif; ?>
		</td>

	</tr>	
</table> 
